<?php
namespace app\sk\controller;

use app\mxadmin\AdminBase;
use app\sk\service\ActionService;

class Index extends AdminBase
{
    public function index()
    {
        $params = input('param.');
        ActionService::indexView($params);
        //var_dump($params);
        //return 'abc';
    }

    /**
     * 列表
     * @return \think\response\View
     */
    public function list()
    {
        $params = input('param.');
        $list=ActionService::list($params);
        return $this->result($list);
    }

    /**
     * 添加编辑
     * @return \think\response\View
     */
    public function add()
    {
        if (request()->isPost()){
            $params = input('param.');
            $list=ActionService::add($params);
            if ($list['code']==1) {
                return $this->success($list['msg']);
            } else {
                return $this->error($list['msg']);
            }
        }
    }

    /**
     * 添加编辑
     * @return \think\response\View
     */
    public function edit()
    {
        if (request()->isPost()){
            $params = input('param.');
            $list=ActionService::edit($params);
            if ($list['code']==1) {
                return $this->success($list['msg']);
            } else {
                return $this->error($list['msg']);
            }
        }
    }

    /**
     * 删除
     * @return \think\response\View
     */
    public function del()
    {
        $params = input('param.');
        $list=ActionService::del($params);
        return $this->success('删除成功');
    }

    /**
     * 订单导出
     * @return \think\response\View
     */
    public function export()
    {
        $params = input('param.');
        ActionService::export($params);
        
    }
}
